package com.ssl.npe;

import lombok.extern.slf4j.Slf4j;

import java.util.HashMap;
import java.util.Map;

/**
 * 描述：
 *
 * @author ssl
 * @create 2021/7/7 0007.
 */
@Slf4j(topic = "com.ssl.npe")
public class OperatorTest {

    public static void main(String[] args) {
        Map<String, Boolean> map = new HashMap<>();
        Boolean b1 = null != map ? map.get("test") : Boolean.FALSE;
        System.out.println(b1); // null


//        boolean b2 = null != map ? map.get("test") : Boolean.FALSE; // NullPointerException
//        System.out.println(b2);

        Boolean b3 = true ? null : Boolean.FALSE;
        System.out.println(b3); // null



    }
}
